import "package:ct_pa_majordomo/config/theme_vars.dart";
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";

class NormalScaffold extends StatefulWidget {
  final List<Widget>? actions;
  final Widget? child;
  final String title;
  final Widget? leading;
  final Widget? floatingActionButton;
  final PreferredSizeWidget? bottom;
  
  const NormalScaffold({
    super.key, 
    this.actions, 
    this.child, 
    required this.title, 
    this.leading,
    this.floatingActionButton,
    this.bottom,
  });

  @override
  State<StatefulWidget> createState() => _NormalScaffoldState();

}

class _NormalScaffoldState extends State<NormalScaffold> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        iconTheme: const IconThemeData(color: Colors.white),
        foregroundColor: Colors.white,
        title: Text(widget.title),
        centerTitle: true,
        backgroundColor: ThemeVars.colorPrimary,
        leading: widget.leading ?? IconButton(
          icon: const Icon(Icons.arrow_back_ios),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        actions: [if (widget.actions != null) ...?widget.actions,],
        bottom: widget.bottom ?? widget.bottom,
      ),
      floatingActionButton: widget.floatingActionButton,
      body: widget.child ?? widget.child,
    );
  }

}